//
//  DYHorizontalTableView.m
//  ScrollTableViewTest
//
//  Created by 黄德玉 on 2018/7/16.
//  Copyright © 2018年 none. All rights reserved.
//

#import "DYHorizontalTableView.h"

@interface DYHorizontalTableView()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView * tableView;
@property (nonatomic,strong) UIScrollView * scrollView;

@end

@implementation DYHorizontalTableView


- (instancetype)init
{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.tableView = [[UITableView alloc] init];
        self.tableView.delegate = self;
        self.tableView.dataSource = self;
//        [self addSubview:self.tableView];
        self.tableView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width + 100, [UIScreen mainScreen].bounds.size.height);
        
        self.scrollView = [UIScrollView new];
        self.scrollView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);

        self.scrollView.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width + 100, [UIScreen mainScreen].bounds.size.height);
        [self addSubview:self.scrollView];
        [self.scrollView addSubview:self.tableView];
//        [self.tableView.panGestureRecognizer requireGestureRecognizerToFail:self.scrollView.panGestureRecognizer];
    }
    return self;
}


#pragma mark - tableView delegate and datasource

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = @"xcvz";
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 100;
}


@end
